From 5cd887a6153a7e3f1af4fb7c29a7b10ccf93a51d Mon Sep 17 00:00:00 2001 From: "Allen Kay allen.m.kay@intel.com" Date: Wed, 1 Sep 2010 09:48:52 +0100 Subject: [PATCH] x86 mm: revert check in clear_mmio_p2m_entry() changed in 21940:e7afe98afd43 valid_mfn() cannot be used here as MMIO pages are always above max_mem. Also added sanity checking for type == p2m_mmio_direct before clearing page table entry. This should fix both VT-d and SR-IOV issues reported recently as there are no SR-IOV specific code in Xen. As far as Xen is concern, SR-IOV virtual function is just another PCI device. Signed-off-by: Allen Kay allen.m.kay@intel.com Signed-off-by: Tim Deegan --- xen/arch/x86/mm/p2m.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 6d12ec2c2a..7c0373effe 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -2620,7 +2620,9 @@ clear_mmio_p2m_entry(struct p2m_domain *p2m, unsigned long gfn) return 0; mfn = gfn_to_mfn(p2m, gfn, &t); - if ( !mfn_valid(mfn) ) + + /* Do not use mfn_valid() here as MMIO pages are always above max_page */ + if ( (INVALID_MFN == mfn_x(mfn)) || (t != p2m_mmio_direct) ) { gdprintk(XENLOG_ERR, "clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn); -- 2.30.2